c program to find greatest and smallest element of array